< previous page page_560 next page >

Page 560
Type.gifListing 14.16. Defining the Property Let and Property Get routines for the DefaultAction property.
Public Property Get DefaultAction() As errReturn
    '
    ' return default
    '
    DefaultAction = errDefRtn
    '
End Property

Public Property Let DefaultAction(ByVal vNewValue As errReturn)
    '
    ' verify parm and store
    '
    If vNewValue >= errExit Or vNewValue <= errselect Then
        errDefRtn = vNewValue
    End If
    '
End Property
Note that the data type for the property is errReturn. This is one of the enumerated types defined in the declaration section of the class module. Next, create the Property Let and Property Get routines for the DefaultType property, and enter the code from Listing 14.17 into the project.
Type.gifListing 14.17. Coding the Property Let and Property Get routines for the DefaultType property.
Public Property Get DefaultType() As errType
    '
    DefaultType = errDefType
    '
End Property

Public Property Let DefaultType(ByVal vNewValue As errType)
    '
    If vNewValue >= errcoll Or vNewValue <= erritem Then
        errDefType = vNewValue
    End If
    '
End Property
Finally, you're ready to write the main error handler method. This method can be called from any VBA-compliant program. You pass the Visual Basic Err object (or database Errors collection) along with a few optional parameters that can control the behavior of the message dialog box. After the method has been completed, a value is returned. This value can be used to control program flow and error recovery.

 
< previous page page_560 next page >

If you like this book, buy it!